<?php 
	//header("Content-Type: image/jpeg"); 
	//echo $_GET["nombre"];
	$image = $_GET["nombre"];
	//$image = dirname(__FILE__) . "/images/examples/example5.jpg"; 
	$path =  strrchr($image, "/");
	$w = $_GET["w"];
	$h = $_GET["h"];
	$x = $_GET["x"];
	$y = $_GET["y"];
	$w2 = $_GET["w2"];
	$h2 = $_GET["h2"];
	$x2 = $_GET["x2"];
	$y2 = $_GET["y2"];
	if ($w && $h) 
	{
		 $image_rs = imagecreatefromjpeg($image);
		 //default size
		 $new_rs = imagecreatetruecolor(160, 120);
		 imagecopyresampled( $new_rs, $image_rs, 0, 0, $x, $y, 160, 120, $w, $h);
		 imagejpeg($new_rs,"./upload/defaultSize".$path);
		 //double height
		 $new_rs = imagecreatetruecolor(160, 240);
		 imagecopyresampled( $new_rs, $image_rs, 0, 0, $x2, $y2, 160, 240, $w2, $h2);
		 imagejpeg($new_rs,"./upload/doubleHeight".$path);
		 //double size
		 $new_rs = imagecreatetruecolor(320, 240);
		 imagecopyresampled( $new_rs, $image_rs, 0, 0, $x, $y, 320, 240, $w, $h);
		 imagejpeg($new_rs,"./upload/doubleSize".$path);
	} 
	//readfile($image);
	header( 'Location: admin.php' ) ;
?>
